package service.impl;

import dao.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.User;
import service.UserService;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> findAllWithRole() {
        return userMapper.findAllWithRole();
    }

    @Override
    public User findById(int userId) {
        return userMapper.findById(userId);
    }

    @Override
    public User findByUserName(String userName) {
        return userMapper.findByUserName(userName);
    }

    @Override
    public List<User> findAll() {
        return userMapper.findAll();
    }

    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public int updateUserInfo(User user) {
        return userMapper.updateUserInfo(user);
    }

    @Override
    public int updatePassword(int userId, String password) {
        return userMapper.updatePassword(userId, password);
    }

    @Override
    public int updateLoginInfo(int userId) {
        return userMapper.updateLoginInfo(userId);
    }

    @Override
    public int deleteUser(int userId) {
        return userMapper.deleteUser(userId);
    }
}